jQuery(document).ready(function($) {   
    //logo滚动消失,导航置顶
    $(window).scroll(function(){
          $('.main-header').toggleClass('scrolled', $(this).scrollTop() > 1);
          $(this).scrollTop() > 1? $('#toTop').show(300) : $('#toTop').hide(300);
          $(this).scrollTop() > 1? $('.logo').hide(): $('.logo').show();
     });
     
// 頂部導航
    var lastId,
        topMenu = $(".main-header,.menu-responsive,.topmenu"),
        topMenuHeight = topMenu.outerHeight()+10,
        menuItems = topMenu.find("a"),
        scrollItems = menuItems.map(function(){
          var item = $($(this).attr("href"));
          if (item.length) { return item; }
        });
        var ww=$(document.body).width();
    menuItems.click(function(e){
      var href = $(this).attr("href"),
          offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight;
      $('html,body').stop().animate({ 
          scrollTop: offsetTop
      }, 300);
      e.preventDefault();
      $(this).parent().addClass("active").end().parent().siblings().removeClass("active");
	if (ww<=980){
               $(".menu-responsive").hide();     
         }
    });


     
//TO Top
    $('a[href="#top"]').click(function(e){
        $('html, body').animate({scrollTop: 0}, 'slow');
        e.preventDefault();
    });
    
$(".pinglun_ico").click(function(){
    $(".contact-form").slideToggle();
    
    
})

//    $('.flexslider').flexslider({
//      slideshow: true,
//      slideshowSpeed: 3000,  
//      animation: "fade",
//      directionNav: false,
//    });

//手机端导航
    $('.toggle-menu').click(function(e){
        $('.menu-responsive').slideToggle();
         e.preventDefault();
    });
    
 //加载音乐播放器
        $(function(){
                        $("#myAudio").initAudio();
                });	
                
 /*留言*/
$(".messge_nav").click(function () {
    $(".message_content").slideToggle();
});
//prettyPhoto
   $("area[rel^='prettyPhoto']").prettyPhoto();
                            $(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed: 'normal', theme: 'light_square', slideshow: 3000, autoplay_slideshow: false});
                            $(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animation_speed: 'fast', slideshow: 3000, hideflash: true});
                            

     

});

